]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
bluetooth: When the placeholder is shown, announce it when reaching the toggle
authorLukáš Tyrychtr <ltyrycht@redhat.com>
Tue, 24 Sep 2024 11:44:15 +0000 (13:44 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 17 Oct 2024 17:41:45 +0000 (19:41 +0200)
Previously, the menu would be just empty, without any indication why.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3485>
(cherry picked from commit 3bd68fcfd7a1088e26f8631f27f73e67581413a2)

js/ui/status/bluetooth.js

index 5d3581c423c4bcce10d1b1fea94114ae24dc7122..5797de8adebace3c1a36cf9f97d404ba2e3b52a9 100644 (file)
@@ -1,5 +1,6 @@
 import 'gi://GnomeBluetooth?version=3.0';
 
+import Atk from 'gi://Atk';
 import Gio from 'gi://Gio';
 import GLib from 'gi://GLib';
 import GnomeBluetooth from 'gi://GnomeBluetooth';
@@ -335,9 +336,19 @@ class BluetoothToggle extends QuickMenuToggle {
             : _('Turn on Bluetooth to connect to devices');
     }
 
+    _updatePlaceholderRelation() {
+        const accel = this.get_accessible();
+        const placeholderAccel = this._placeholderItem.get_accessible();
+        if (this._deviceSection.actor.visible)
+            accel.remove_relationship(Atk.RelationType.DESCRIBED_BY, placeholderAccel);
+        else
+            accel.add_relationship(Atk.RelationType.DESCRIBED_BY, placeholderAccel);
+    }
+
     _updateDeviceVisibility() {
         this._deviceSection.actor.visible =
             [...this._deviceItems.values()].some(item => item.visible);
+        this._updatePlaceholderRelation();
     }
 
     _getSortedDevices() {